﻿using UnityEditor;
using UnityEngine;
using UnityEngine.SceneManagement;

public static class ClientCmdParser
{

    //玩家的角色列表 S-->C
    public static void OnRoleList(Cmd cmd)
    {

        if (!Client.CherkCmd(cmd, typeof(RoleListCmd)))
            return;
        RoleListCmd roleListCmd = cmd as RoleListCmd;

        //Debug.Log("解析角色列表");
        //Debug.Log(roleListCmd.AllRole.Count);

        //已存在玩家数据
        Server.GetInstance().CurPlayer.AllRole = roleListCmd.AllRole;

        if (roleListCmd.AllRole.Count > 0)
        {
            ScenesManager.GetInstance().LoadSceneAsyn(SceneManager.GetActiveScene().buildIndex + 1, () => {

                UIMgr.GetInstance().Replace("UI/SelectRole/SelectRolePanel");
            });
        }
    }
}
